/**
 * Created by vincent on 2017/4/13.
 */
moduleMain.controller('ChangePasswordController', function ($$CambioConfig, $scope, $log, $filter, LoadingService, DialogService,
                                                            ManagerResource) {

    $scope.$on("ngDialog.opened", function () {
        dialogOnLoad();
    });

    $scope.cancel = function () {
        DialogService.close();
    };

    $scope.userData = {};

    $scope.submit = function () {
        //LoadingService.show();
        if (!StringUtils.isNlOrUndOrEmpty($scope.userData.userName)
            && !StringUtils.isNlOrUndOrEmpty($scope.userData.newPass)
            && !StringUtils.isNlOrUndOrEmpty($scope.userData.oldPass)) {
            ManagerResource.changePassword($scope.userData, function (userResult) {
                $log.debug("修改密码结果", userResult);
                DialogService.close();
                //LoadingService.hide();
                Alert.success("更改密码成功！");
            });
        } else {
            Alert.error("请求参数不全！");
        }
    };

});